/**
 * Created by webrx on 2024/4/26.
 */
import router from '@/router'

const allow: string[] = ['/login', '/member', '/info']

//beforeResolve
//beforeEach
router.beforeResolve((to, from, next) => {
    //console.log('to', to, to.path, to.name)
    //console.log('from', from, from.path, from.name)
    //console.log('from', from.path, from.fullPath, from.name)
    //console.log('to', to.path, to.fullPath, to.name)

    if (to.meta.title) {
        document.title = to.meta.title.toString()
    } else {
        document.title = '商城后台管理系统'
    }

    if (allow.includes(to.path)) {
        next()
    } else {

        next('/login')
    }
})
